package org.example.config;

import org.example.interceptor.Jwtinterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author xietl
 * @date 2025/10/8  15:34
 * @description WebMvc配置类  * 用于注册拦截器
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private Jwtinterceptor jwtinterceptor;

    /**
     * 注册拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(jwtinterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login","/user/register","user/getotp");
    }
}
